const express = require('express');
const router = express.Router();

let {img_upload,img_del,read_html} = require("../controller/api/file");      //文件上传与删除
router.post('/img',img_upload);
router.get('/img/delete',img_del);
router.get('/html/read',read_html);

let {content_index,content_release} = require("../controller/content");          //内容管理
router.get('/content',content_index);
router.get('/content/release',content_release);
let {find_module_name,get_dynamic_find,update_dynamic_find,del_dynamic_find,
    create_dynamic_find,get_dynamic_find_by_id} = require("../controller/api/content");
router.get('/content/find-model-name',find_module_name);                         /** 查找所有模块名 **/
router.get('/content/get-dynamic-find',get_dynamic_find);                        /** 根据模块名查找数据 **/
router.post('/content/update-dynamic-find',update_dynamic_find);                 /** 更新数据 **/
router.post('/content/del-dynamic-find',del_dynamic_find);                       /** 删除数据 **/
router.post('/content/create-dynamic-find',create_dynamic_find);                 /** 创建数据 **/
router.get('/content/get-dynamic-find-by-id',get_dynamic_find_by_id);            /** 根据id获取数据**/

let {module_index,module_create,module_img_edit} = require("../controller/module");  //发现栏目定义
router.get('/module',module_index);
router.get('/module/create',module_create);
router.get('/module/img/edit',module_img_edit);

let {create_model,get_model_by_id,update_model,
    get_photos_change_by_id,create_photos_change,update_photos_model} = require("../controller/api/module");
router.post('/module/create-model',create_model);                                       /** 创建模块 **/
router.get('/module/get-model-by-id',get_model_by_id);                                  /** 根据id获取模块信息 **/
router.post('/module/update-model',update_model);                                       /** 更新模块 **/
router.get('/module/get-photos-change-by-id',get_photos_change_by_id);                 /** 根据模块id获取栏目图片轮播 **/
router.post('/module/create-photos-change',create_photos_change);                       /** 创建模块栏目图片轮播 **/
router.post('/module/update-photos-change',update_photos_model);                         /** 更新模块栏目图片轮播 **/

let {start_index,start_create} = require("../controller/start");  //app启动设置
router.get('/start',start_index);
router.get('/start/create',start_create);
let {get_app_run,update_app_run} = require("../controller/api/start");
router.get('/start/get-app-run',get_app_run);                                  /** 获取appRun 内容 **/
router.post('/start/update-app-run',update_app_run);                           /** 更新appRun 内容 **/

module.exports = router;
